SRC=ctrb.c
SRC+=logsys.c 
SRC+=pidctr.c 
SRC+=sensor.c 
SRC+=work.c

LIBS+=-lpthread

INC+=-I./
INC+=-I$(DRIVERSDOR)

.PHONY: function function_install function_clean

function:
	cd $(FUNCTIONDIR);$(CC) -c $(SRC) $(INC)
ifeq ($(SHARED),true)
	@$(CC) -fPIC -shared -o $(FUNCTIONDIR)/libworker.so $(FUNCTIONDIR)/*.o  $(LIBS) $(INC)
	@$(STRIP) libworker.so
	@cp $(FUNCTIONDIR)/libworker.so $(HW_UIBUILDDIR)
else
	$(AR) cr $(FUNCTIONDIR)/libworker.a $(FUNCTIONDIR)/*.o
	@cp $(FUNCTIONDIR)/libworker.a $(HW_UIBUILDDIR)
endif

function_install:
ifeq ($(SHARED),true)
	$(STRIP) $(FUNCTIONDIR)/libworker.so
	@cp $(FUNCTIONDIR)/libworker.so $(INSTALLDIR)
endif

function_clean:
	@rm -f $(FUNCTIONDIR)/*.o $(FUNCTIONDIR)/*.so $(FUNCTIONDIR)/*.a
ifeq ($(SHARED),true)
	@rm -f $(HW_UIBUILDDIR)/libworker.so 
else
	@rm -f $(HW_UIBUILDDIR)/libworker.a
endif
